<?php
require('config.php');

        $user_id=$_REQUEST['user_id'];
        //$user_id=54;
        //$orderId=124;
		$sql="select * from `".$oto."_orders`,`".$oto."_order_goods`,`".$oto."_shops` where ".$oto."_orders.userId='".$user_id."' and `orderFlag`='1' and ".$oto."_orders.orderId=".$oto."_order_goods.orderId and ".$oto."_shops.shopId=".$oto."_orders.shopId and ".$oto."_orders.orderStatus='4'";
		//echo $sql;
		//die();
		$result=$db->query($sql);
		while($row=$result->fetch_assoc()){
			$person_info[]=$row;//将取得的所有数据赋值给person_info数组
		}
		if(isset($person_info))
		{
			for($i=0;$i<count($person_info);$i++)
			{
				$orderId=$person_info[$i]['orderId'];
		        $goodsId=$person_info[$i]['goodsId'];
		        $shopId=$person_info[$i]['shopId'];
		        $sql="select * from `".$oto."_goods_appraises` where `userId`='".$user_id."' and orderId='{$orderId}' and goodsId='{$goodsId}' and shopId='{$shopId}'";
				$result=$db->query($sql);
				while($row=$result->fetch_assoc()){
					$appraises_info[$i]=$row;//将取得的所有数据赋值给person_info数组
				}
				if(!isset($appraises_info[$i]))
				{
					$person_info[$i]['pan']=0;
				}
				else
				{
					if($appraises_info[$i]['serviceScore']==0 || $appraises_info[$i]['timeScore']==0 || $appraises_info[$i]['packScore']==0)
					{
						$person_info[$i]['pan']=0;	
					}
					else
					{
						$person_info[$i]['pan']=1;
					}
				}
			}
		}
		echo json_encode($person_info);
?>